/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "cob_detalle", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CobDetalle.findAll", query = "SELECT c FROM CobDetalle c"),
    @NamedQuery(name = "CobDetalle.findByNrofac", query = "SELECT c FROM CobDetalle c WHERE c.cobDetallePK.nrofac = :nrofac"),
    @NamedQuery(name = "CobDetalle.findByCuoNro", query = "SELECT c FROM CobDetalle c WHERE c.cobDetallePK.cuoNro = :cuoNro"),
    @NamedQuery(name = "CobDetalle.findByCobCod", query = "SELECT c FROM CobDetalle c WHERE c.cobDetallePK.cobCod = :cobCod"),
    @NamedQuery(name = "CobDetalle.findByMonto", query = "SELECT c FROM CobDetalle c WHERE c.monto = :monto")})
public class CobDetalle implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CobDetallePK cobDetallePK;
    @Column(name = "monto")
    private Integer monto;
    @JoinColumn(name = "Forma_cobro_fcob_cod", referencedColumnName = "fcob_cod", nullable = false)
    @ManyToOne(optional = false)
    private FormaCobro formacobrofcobcod;
    @JoinColumn(name = "cob_cod", referencedColumnName = "cob_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Cobro cobro;
    @JoinColumns({
        @JoinColumn(name = "cuo_nro", referencedColumnName = "cuo_nro", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "Nro_fac", referencedColumnName = "Nro_fac", nullable = false, insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private CtasCobrar ctasCobrar;

    public CobDetalle() {
    }

    public CobDetalle(CobDetallePK cobDetallePK) {
        this.cobDetallePK = cobDetallePK;
    }

    public CobDetalle(int nrofac, int cuoNro, int cobCod) {
        this.cobDetallePK = new CobDetallePK(nrofac, cuoNro, cobCod);
    }

    public CobDetallePK getCobDetallePK() {
        return cobDetallePK;
    }

    public void setCobDetallePK(CobDetallePK cobDetallePK) {
        this.cobDetallePK = cobDetallePK;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public FormaCobro getFormacobrofcobcod() {
        return formacobrofcobcod;
    }

    public void setFormacobrofcobcod(FormaCobro formacobrofcobcod) {
        this.formacobrofcobcod = formacobrofcobcod;
    }

    public Cobro getCobro() {
        return cobro;
    }

    public void setCobro(Cobro cobro) {
        this.cobro = cobro;
    }

    public CtasCobrar getCtasCobrar() {
        return ctasCobrar;
    }

    public void setCtasCobrar(CtasCobrar ctasCobrar) {
        this.ctasCobrar = ctasCobrar;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cobDetallePK != null ? cobDetallePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CobDetalle)) {
            return false;
        }
        CobDetalle other = (CobDetalle) object;
        if ((this.cobDetallePK == null && other.cobDetallePK != null) || (this.cobDetallePK != null && !this.cobDetallePK.equals(other.cobDetallePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.CobDetalle[ cobDetallePK=" + cobDetallePK + " ]";
    }
    
}
